/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: dell
 * Date: 2024-01-13
 * Time: 18:07
 */
import java.util.Scanner;
class TreeNode {
    public char val;
    public TreeNode left;
    public TreeNode right;

    public TreeNode(char val) {
        this.val = val;
    }
}
public class test2 {
    static int num=0;
    public static void create(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) {
            // 注意 while 处理多个 case
            String str=in.nextLine();
            TreeNode ret=Creattree(str);
            inOrder(ret);
        }
    }
    public static TreeNode Creattree(String str){
        TreeNode node;
        char ch=str.charAt(num);
        num++;
        if(ch!='#'){
            node=new TreeNode(ch);
            node.left=Creattree(str);
            node.right=Creattree(str);
        }else{
            node=null;
        }
        return node;
    }
    public static void inOrder(TreeNode root){
        if (root==null){
            return;
        }
        inOrder(root.left);
        System.out.print(root.val);
        inOrder(root.right);
    }
}